package scrum.client.sprint;

import java.util.List;

import scrum.client.project.Requirement;

public class PullNextRequirementFilteredAction extends PullNextRequirementAction {

	public PullNextRequirementFilteredAction(Sprint sprint) {
		super(sprint);
	}

	@Override
	protected Requirement getNextRequirement() { // extension point
		if (!sprint.isRequirementsFilterActive()) return getCurrentProject().getNextProductBacklogRequirement();

		List<Requirement> filteredReqs = getDao().filterRequirements(getCurrentUser(), getCurrentProject(),
			getCurrentProject().getProductBacklogRequirements());

		if (!filteredReqs.isEmpty()) return filteredReqs.get(0);
		return null;
	}
}
